<template>
	<view class="uni-tab-bar">
		<scroll-view class="uni-swiper-tab" scroll-x>
			<view class="uni-swiper-tab-view" >
				<view class="blockClass" v-for="(tab,index) in tabBars" :key="tab.id">
					<view 
						class="swiper-tab-list" 
						:class="{'active' : tabIndex==index}"
						@tap="tabtap(index)"
						:style="{width:tabWidth+'px'}"
					>
						{{tab.busName ? tab.busName : tab.name}} {{tab.num?tab.num:""}}
						<view class="swiper-tab-line"></view>
					</view>
				</view>
			</view>
			
		</scroll-view>
	</view>
</template>

<script>
	export default {
		props:{
			tabWidth:Number,//每个选项的宽度
			listWidth:Number,
			tabBars:Array,
			tabIndex:Number,
			scrollStyle:{
				type:String,
				default:""
			},
			scrollItemStyle:{
				type:String,
				default:""
			}
		},
		methods:{
			//点击切换导航
			tabtap(index){
				// this.tabIndex = index;
				this.$emit('tabtap',index)
			}
		}
	}
</script>

<style scoped>
	.uni-tab-bar{
		width: 100%;
		/* border-bottom: 1upx solid #E8E8E8; */
	}
	.uni-swiper-tab{
		background-color: #fff;
		:-webkit-scrollbar{
			    display: none;
			}
	}
	
	.uni-swiper-tab-view{
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}
	.blockClass{
		display: flex;
		flex-direction: column;
	}
	.swiper-tab-list{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		color: #333333;
		font-size: 32upx;
		
		
	}
	.uni-tab-bar .active{
		/* font-weight: bold; */
		font-size: 32upx;
		color: #F74343;
	}
	.active .swiper-tab-line{
		/* border-bottom: 4upx solid #F74343; */
		border-style: solid;
		border-width: 0upx;
		border-color: #F74343;
		width: 60upx;
		height: 4upx;
		margin: auto;
		background-color: #F74343;
		border-radius: 2upx;
		margin-top: 10upx;
	}
	/* #ifdef H5 */
		.uni-tab-bar::-webkit-scrollbar{
			width: 0;
			height: 0;
			color: transparent;
		}
		.uni-tab-bar::-webkit-scrollbar {
			width: 0px;
			display: none;
		}
		
		.uni-tab-bar::-webkit-scrollbar-track {
			background-color: none;
		}
		
		.uni-tab-bar::-webkit-scrollbar-thumb {
			background-color: none;
		}
		
		.uni-tab-bar::-webkit-scrollbar-thumb:hover {
			background-color: none;
		}
		
		.uni-tab-bar::-webkit-scrollbar-thumb:active {
			background-color: none;
		}
	/* #endif */
</style>
